#Intersession Time of Wikipedia Users
#Health of Online Communities

import collections
import sys
import datetime


def main():
	users = {}
	
	for line in sys.stdin:
		pieces = line.split('\t')
		userid = pieces[0].strip()
		anon = pieces[1].strip()

		if anon == "0":
			year = int(pieces[4])
			if userid not in users:
				users[userid] = [year, year]
			else:
				(oldstart, oldend) = users[userid]
				users[userid] = [min(year, oldstart), max(year, oldend)]

	# start_year =>
	#	offset_year => count
	table = {}
	for (startyear, endyear) in users.values():
		if not startyear in table:
			table[startyear] = collections.defaultdict(int)
		for offset in range(0, endyear-startyear+1):
			table[startyear][offset] += 1

	print '\t'.join(['year', 'time', 'at_risk', 'died', 'survived'])
	for y in sorted(table.keys()):
		for offset in sorted(table[y].keys()):
			at_risk = table[y][offset]
			survived = table[y][offset+1]
			died = at_risk - survived

			fields = [
				y,
				offset + 1,
				at_risk,
				died,
				survived,
			]

			print '\t'.join([str(value) for value in fields])

main()
